<?php
 /*
 * 1626cms 文章頁面
 * ============================================================================
 * 版權所有: 1626網絡，并保留所有權利。
 * 網站地址: http://www.1626.com；
 * ----------------------------------------------------------------------------
 * 這不是一個自由軟件！您只能在不用于商業目的的前提下對程序代碼進行修改和
 * 使用；不允許對程序代碼以任何形式任何目的的再發布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once('../data/config.php');
require_once('./include/admin_common.inc.php');
require_once(ADMIN_ROOT_PATH.'include/admin_article_fun.php');
$act = !empty($_GET['act']) ? trim($_GET['act']) : '1';
if($act == '1'){
require_once(ADMIN_ROOT_PATH.'include/page.class.php');
$Parent=$_GET['Parent'];
$type_id=$_GET['type_id'];
$focos=$_GET['focos'];
$key=trim($_POST['key']);
!empty($_POST['perpage'])?(setcookie('perpage',intval($_POST['perpage']))).($perpage=intval($_POST['perpage'])):($perpage= !empty($_COOKIE['perpage'])? $_COOKIE['perpage'] :'10');
$get_news_sql=" where id is not null ";
!empty($Parent)?($get_news_sql.=" and  ParentID=".$Parent).($get_article_Parent_list=get_article_Parent_list($Parent)):'';
!empty($type_id)?($get_news_sql.=" and  type_id=".$type_id):'';
!empty($focos)?($get_news_sql.=" and focos=".$focos):'';
!empty($key)?($get_news_sql.=" and title like '%{$key}%'"):'';
$total_sql="SELECT COUNT(*) AS num FROM ".table('article').$get_news_sql;
$page = new page(array('total'=>get_total($total_sql), 'perpage'=>$perpage));
$currenpage=$page->nowindex;
$offset=($currenpage-1)*$perpage;
$article_list = get_news($offset, $perpage,$get_news_sql);
$smarty->assign('act',$act);//標簽ID
$smarty->assign('get_article_Parent',get_article_Parent());//頂級分類列表
$smarty->assign('article_list',$article_list);//文章列表
$smarty->assign('page',$page->show(3));//分頁符
$smarty->assign('Parent',$Parent);//頂級分類GET
$smarty->assign('type_id',$type_id);//下級分類GET
$smarty->assign('focos',$focos);//屬性分類GET
$smarty->assign('key',$key);//關鍵字POST
$smarty->assign('perpage',$perpage);//每頁顯示數量POST
$smarty->assign('get_article_Parent_list',$get_article_Parent_list);//下級分類列表
$smarty->assign('get_article_property',get_article_property());//文章屬性列表
$smarty->assign('category_list',get_article_category());//獲取文章分類
$smarty->assign('pageheader',"管理中心 - 文章管理 - 文章列表");//提示標題
$smarty->display('admin_article.htm');
}
if($act == '2'){
$smarty->assign('act',$act);
$smarty->assign('ty_id',$_GET['ty_id']);
$smarty->assign('author',$_SESSION['admin_name']);
$smarty->assign('category_list',get_article_category());//獲取分類
$smarty->assign('get_article_property',get_article_property());//文章屬性列表
$smarty->assign('pageheader',"管理中心 - 文章管理 - 添加文章");
$smarty->display('admin_article_add.htm');
}
if($act == '3'){
$smarty->assign('act',$act);
$smarty->assign('pageheader',"管理中心 - 文章管理 - 文章屬性");
$smarty->assign('get_article_property',get_article_property());//文章屬性列表
$smarty->display('admin_article_property.htm');
}
if($act == '4'){
$smarty->assign('act',$act);
$smarty->assign('pageheader',"管理中心 - 文章管理 - 文章分類");
$smarty->assign('category_list',get_article_category());
$top_category_list=get_article_category();
$smarty->assign('top_category_list',$top_category_list['0']['id']);//返回第一條分類id
$bottom_category_list=array_reverse(get_article_category());
$smarty->assign('bottom_category_list',$bottom_category_list['0']['id']);//返回末尾分類id
$smarty->display('admin_article_category.htm');
}
if($act == 'article_edit'){
$id = !empty($_GET['id']) ? trim($_GET['id']) : '';
if ($id<>"")
{
$sql = "select * from ".table('article')." where id=".$id;
$edit_article=$db->getone($sql);
$smarty->assign('act',$act);
$smarty->assign('edit_article',$edit_article);//讀取指定ID的新聞
$smarty->assign('upfiles_dir',$upfiles_dir);//上傳目錄
$smarty->assign('thumb_dir',$thumb_dir);//縮略圖目錄
$smarty->assign('category_list',get_article_category());//獲取分類
$smarty->assign('get_article_property',get_article_property());//文章屬性列表
$smarty->assign('pageheader',"管理中心 - 文章管理 - 修改文章");
$smarty->display('admin_article_edit.htm');
}
}
//增加屬性分類
if($act == 'property_add')
{
$smarty->assign('act',"3");
$smarty->assign('pageheader',"管理中心 - 文章管理 - 添加屬性");
$smarty->display('admin_article_property_add.htm');
}
//增加文章分類
if($act == 'category_add')
{
$ParentID = !empty($_GET['ParentID']) ? trim($_GET['ParentID']) : '0';
$smarty->assign('act',"4");
$smarty->assign('ParentID',$ParentID);
$smarty->assign('get_article_Parent',get_article_Parent());//頂級分類列表
$smarty->assign('pageheader',"管理中心 - 文章管理 - 增加分類");
$smarty->display('admin_article_category_add.htm');
}
//修改文章分類
if($act == 'edit_category' && $_GET['y_id'])
{
$smarty->assign('act',"4");
$y_id=$_GET['y_id'];
$smarty->assign('article_category',get_article_category_one($y_id));//文章分類字段
$smarty->assign('get_article_Parent',get_article_Parent());//頂級分類列表
$smarty->assign('pageheader',"管理中心 - 文章管理 - 修改分類");
$smarty->display('admin_article_category_edit.htm');
}
?>
